//
//  VerifyPhoneHeader.swift
//  Nahuo
//
//  Created by zang qilong on 2017/5/9.
//  Copyright © 2017年 zang qilong. All rights reserved.
//

import Foundation
import UIKit

struct NaHuoHttpUtil {
    let appVersion:String
    let dType:String
    let platform:String
    let dVersion:String
    static let sharedInstance = NaHuoHttpUtil()
    
    private init() {
        appVersion = "1.0"
        dType = UIDevice.current.model
        platform = "1"
        dVersion = (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String)!
    }
    
    func generateVerifyMobileHeader() -> [String: String] {
        let commonHeader = ["appVersion": appVersion, "dType": dType, "platform": platform, "dVersion": dVersion]
        if let tokenExist = UserDefaults.standard.getAuthenticationToken() {
            return ["Authorization": "Bearer \(tokenExist)"]
        }else {
            return commonHeader
        }
        
    }
}
